package music_store.ms.common.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @Author: Redi
 * @Date: 2021/9/14 20:02
 * @Description:
 */

@Configuration
public class MyPingConfig extends WebMvcConfigurerAdapter {

//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        //获取文件的真实路径 work_project代表项目工程名 需要更改
//        String path = System.getProperty("user.dir")+"\\music_store\\src\\main\\resources\\static\\";
//        String os = System.getProperty("os.name");
//        if (os.toLowerCase().startsWith("win")) {
//            registry.addResourceHandler("/**").
//                    addResourceLocations("file:"+path);
//        }else{//linux和mac系统 可以根据逻辑再做处理
//            registry.addResourceHandler("/**").
//                    addResourceLocations("file:"+path);
//        }
//        super.addResourceHandlers(registry);
//    }
}
